﻿Imports Tom0014
Partial Class pruebas_ManejoTablas
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim numrows As Integer = 5
        Dim numcells As Integer = 3
        Dim j As Integer
        For j = 0 To numrows - 1
            Dim r As New TableRow()
            Dim i As Integer
            For i = 0 To numcells - 1
                Dim c As New TableCell()
                If Not (j = 3) Then
                    Dim lb As New Label
                    lb.ID = "m" + j.ToString + i.ToString
                    lb.Text = "Texto" + i.ToString
                    c.Controls.Add(lb)
                    c.Controls.Add(New LiteralControl("row " & j.ToString() & ", cell " & i.ToString()))
                Else
                    Dim catalogo As New catalogo_generalDataTable
                    Dim catRow1, catRow2 As catalogo_generalRow
                    catRow1 = catalogo.Newcatalogo_generalRow()
                    catRow1.cattip = "RL"
                    catRow1.catcve = "TLR"
                    catRow1.catnom = "PRUEBA"
                    catRow2 = catalogo.Newcatalogo_generalRow()
                    catRow2.cattip = "RL"
                    catRow2.catcve = "TL"
                    catRow2.catnom = "PRUEBA 3"
                    catalogo.Addcatalogo_generalRow(catRow1)
                    catalogo.Addcatalogo_generalRow(catRow2)
                    catalogo.Addcatalogo_generalRow("RL", "TOM", "RODRIGO")
                    catalogo.Addcatalogo_generalRow("RL", "OHL", "OSCAR")
                    catalogo.Addcatalogo_generalRow("RL", "APC", "ANTONIO")
                    Dim GridView1 As New GridView
                    GridView1.DataSource = catalogo
                    GridView1.DataBind()
                    c.Controls.Add(GridView1)
                End If


                r.Cells.Add(c)
            Next i
            tbPrincipal.Rows.Add(r)
        Next j



        For Each Control In tbPrincipal.Controls
            Dim row As TableRow = Control
            Response.Write(Control.GetType().ToString)
        Next


        ' Dim labe As Label = FindControl("m02")
        'Label2.Text = labe.Text

    End Sub
End Class
